@extends('layouts.app')

@section('content')
	{{--<div data-options="region:'center'"  class="easy_center">
		<div id="tt" class="easyui-tabs" style="width:100%;" data-options="border:false,fit:true,plain:true">
			<div title="首页"></div>
		</div>
	</div>--}}
	<div class="main-content">
		<div class="search_inp">
			<table width="100%" border="1" class="table_search">
				<thead>
					<tr>
						<th colspan="6">
							<span>查询条件</span>
						</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td width="13.33%" align="right"><label>项目名称：</label></td>
						<td width="20%"><input type="text" class="w150" name="name" placeholder="请输入项目名称"/></td>

						

						<td width="13.33%" align="right"><label>工程类别：</label></td>
						<td width="20%">
							<select name="gclb" class="w150">
								<option value="">请选择工程类别</option>

								<option value="1">营业场所</option>
								<option value="2">金库</option>
								<option value="3">自助银行</option>
								<option value="4">自助机器</option>

							</select>
						</td>

						<td width="13.33%" align="right"><label>工程属性：</label></td>
						<td width="20%">
							<select name="gcsx" class="w150">
								<option value="">请选择工程属性</option>
								<option value="1">新建</option>
								<option value="2">改建</option>
						

							</select>
						</td>


					</tr>
					<tr>
						<td width="13.33%" align="right"><label>达标情况：</label></td>
						<td width="20%">
							<select name="is_ok" class="w150">
								<option value="">请选择达标情况</option>
								<option value="3">未处理</option>
								<option value="1">合格</option>
								<option value="2">不合格</option>
							
							</select>
						</td>
						<td width="13.33%" align="right"></td>
						<td width="20%">
							
							<a href="javascript:" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width:80px" onclick="doSearch()">查询</a>

							

						</td>
						<td></td>
						<td></td>
					</tr>
				</tbody>
			</table>
		</div>
		<div class="btn-toolbar list-toolbar">
			<div class="form-all mg_t30">
				<div id="tb">
					
					
					<a class="easyui-linkbutton" iconCls="icon-add" plain="true"  onclick="add()">新增</a>
					<a class="easyui-linkbutton" iconCls="icon-edit" plain="true"  onclick="edit()">编辑</a>
					<a class="easyui-linkbutton" iconCls="icon-save" plain="true" onclick="jump1()">相关资料</a>
					{{--<a class="easyui-linkbutton" iconCls="icon-print" plain="true">打印</a>--}}

					<a class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="cancel()">移除</a>
					
				</div>
				<table id="dg" title="金融机构行政许可备案" class="easyui-datagrid" style="width:100%;height:600px"
						data-options="rownumbers:true,singleSelect:true,pagination:true,pageSize:20,url:'{{url('admin/xz/xzindex')}}',method:'get',toolbar:'#tb'">
					<thead>
						<tr>
							<th data-options="field:'name'" width="11%" align="center">项目名称</th>
							<th data-options="field:'unitname'" width="15%" align="center">申请单位</th>
							<th data-options="field:'up_unit'" width="15%" align="center">上级主管单位</th>
							<th data-options="field:'gclb'" width="15%" align="center">工程类别</th>
							<th data-options="field:'gcsx'" width="15%" align="center">工程属性</th>
							<th data-options="field:'fxdj'" width="15%" align="center">风险等级</th>
							<th data-options="field:'is_ok'" width="15%" align="center">达标情况</th>
							
						</tr>
					</thead>
				</table>
		  </div>
		</div>
	</div>

	<!--新增-->
	<div id="w" class="easyui-window" closed="true">

	</div>
	<!--编辑-->
	<!--注销-->
	<div id="dlg" class="easyui-dialog" title="注销" closed="true" style="width:400px;height:200px;line-height:100px;text-align:center;font-size:16px;padding:10px">
		您确定要移除该项目？
	</div>


	<script type="text/javascript">
		/*function formatAction(value,row,index){
			return '<a href="'+'edit/'+value+'" target="_blank">编辑</a>';
		}*/
		/*window.onload = function(){
			doSearch();
		}*/
		//搜索
		function doSearch(){
			$('#dg').datagrid('load',{
				gclb: $("select[name='gclb']").val(),
				gcsx: $("select[name='gcsx']").val(),
				is_ok: $("select[name='is_ok']").val(),
				name: $("input[name='name']").val(),
				
			});
		}


		function load_city_data_from_menu($id){
			$('#dg').datagrid('load',{
				city: $id,
			});
			$("input[name='city']").val($id);
			$("input[name='area']").val('');
			$("input[name='org_id']").val('');
		}

		function load_area_data_from_menu($id){
			$('#dg').datagrid('load',{
				area: $id,
			});
			$("input[name='city']").val('');
			$("input[name='area']").val($id);
			$("input[name='org_id']").val('');
		}
		function load_org_data_from_menu($id){
			$('#dg').datagrid('load',{
				org_id: $id,
			});
			$("input[name='city']").val('');
			$("input[name='area']").val('');
			$("input[name='org_id']").val($id);
		}

	</script>
    <script src="{{ URL::asset('/') }}js/weizhi.js"></script>
	<script type="text/javascript">
		
		function add(){
			var shuz = fb1();
			$('#w').window({
				title: "新增",
				href: 'xzadd',
				width:shuz[0],
				height:shuz[1],
				minimizable:false,
                top:shuz[2],
                left:shuz[3],
				modal:true,
				closed: false,
			});
		}
		function edit(){
			var shuz = fb1();
			var row = $('#dg').datagrid('getSelected');
			if (row) {
				var url = 'xzedit/'+row.jrjg_id;
				$('#w').window({
					title: "编辑",
					href: url,
					width:shuz[0],
					height:shuz[1],
					minimizable:false,
	                top:shuz[2],
	                left:shuz[3],
					modal:true,
					closed: false,
				});
			} else {
				$.messager.alert('提示','请选中要编辑的行！');
			}
		}
		function cancel(){
			var row = $('#dg').datagrid('getSelected');
			if (row) {
				$('#dlg').dialog({
					title: "移除",
					closed: false,
					modal:true,
					top:($(window).height() - 200) * 0.5,
					left:($(window).width() - 400) * 0.5,
					buttons: [{
						text: '确定',
						iconCls: 'icon-ok',
						handler: zhuxiao
					}, {
						text: '取消',
						iconCls: 'icon-cancel',
						handler: function () {
							$('#dlg').dialog('close');
						}
					}]
				});
			} else {
				$.messager.alert('提示','请选中要移除的行！');
			}
		}


		function zhuxiao(){
            $('#dlg').dialog('close');
            var row = $('#dg').datagrid('getSelected');
            var url = 'delxz/'+row.jrjg_id;
            $.ajax({
                type: 'get',
                url: url,
                success: function(data){
                    if(data.status == 1){
                        $.messager.alert('信息提示',data.msg,'info');
                      
                        var rowIndex = $('#dg').datagrid('getRowIndex', row);
                        $('#dg').datagrid('deleteRow', rowIndex);
                    }else{
                        $.messager.alert('信息提示',data.msg,'info');
                    }
                }
            });
        }



		//相关文件查看
		function jump1(){
			var shuz = fb1();
			var row = $('#dg').datagrid('getSelected');
			if (row) {
				var url = 'xzup/'+row.jrjg_id;
				$('#w').window({
					title: "相关资料",
					href: url,
					width:shuz[0],
					height:shuz[1],
					minimizable:false,
	                top:shuz[2],
	                left:shuz[3],
					modal:true,
					closed: false,
					minimizable:false,
				});
			} else {
				$.messager.alert('提示','请选中一条记录！');
			}

			// $('#w').window({
			// 	onMinimize: function () {
			// 		$('#w').window('move', {
			// 			left: "0%",
			// 			top: "95%"
			// 		}).window('collapse').window('open');
			// 	}
			// });
		}


	
		$("#dg").datagrid({
			onDblClickRow: function (index, row) {
				edit();
			}
		});
	</script>

@stop
